package com.fourth.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fourth.dao.AppealDao;
import com.fourth.dao.BusinessDao;
import com.fourth.service.AppealService;
import com.ljx.entity.Appeal;
import com.ljx.vo.Result;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;


/**
 * @author C-Q
 * @version 1.1.0
 * @Description: TODO
 * @date 2023/2/27
 */
@Service
public class AppealServiceImpl implements AppealService {

    @Resource
    private AppealDao appealDao;
    @Resource
    private BusinessDao businessDao;
    /**
     * 申诉处理表联表查询
     * @return
     */
    @Override
    public Result appealSelectAll(Integer currentPage, Integer pageSize ,Appeal appeal) {
        Page<Appeal> page = new Page<>(currentPage,pageSize);
        Page<Appeal> list = appealDao.appealSelectAll(page,appeal.getBusinessId());
        System.out.println(list);
        return new Result(2000,"查询成功",list);


    }

    /**
     * 通过ID将当前表状态 status = 1
     * @param
     * @return
     */
    @Override
    public Result passAppeal(Integer id , Integer status) {
        int i = appealDao.passAppeal(id,status);
        return new Result(2000,"修改成功",i);
    }

    @Override
    public Result addAppealAll(Integer currentPage, Integer pageSize, Appeal appeal) {
        int i = appealDao.addAppealAll(appeal);
        return new Result(2000,"添加成功",i);
    }

    @Override
    public Result appealStatusId(Integer id, Integer status,String busid) {
        int i = appealDao.appealStatusId(id, status);
            businessDao.updateBusinessState(busid);
        return new Result(2000,"修改成功",i);
    }


}
